package com.huawei.appmarket.service.store.awk.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.appmarket.service.store.awk.card.SubstanceListCenterCard;
import o.cdr;
import o.chz;
import o.cih;
import o.eib;
import o.epv;
import o.ewm.h;
import o.ewm.j;

public class SubstanceListCenterNode extends cdr {
    private View ˊ;

    public SubstanceListCenterNode(Context context) {
        super(context, 1);
    }

    public int ˏ() {
        return 2;
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        View inflate = from.inflate(h.ᐝˌ, null);
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(j.ʾʻ);
        this.ˊ = inflate.findViewById(j.ॱㆍ);
        Context context = viewGroup.getContext();
        int ˏ = ˏ();
        int ॱॱ = eib.ॱॱ();
        int ʽ = eib.ʽ();
        int ˏ2 = eib.ˏ();
        LayoutParams layoutParams = new LinearLayout.LayoutParams(ˏ2, -1);
        int ˎ = epv.ˎ(context, ˏ, ˏ2);
        int ʽ2 = (int) (((float) ˎ) * epv.ʽ());
        for (ˏ2 = 0; ˏ2 < ˏ; ˏ2++) {
            View inflate2 = from.inflate(h.ᐝꓸ, null);
            cih substanceListCenterCard = new SubstanceListCenterCard(context);
            substanceListCenterCard.ˏ(inflate2);
            ˊ(substanceListCenterCard);
            linearLayout.addView(inflate2, new LinearLayout.LayoutParams(ˎ, ʽ2));
            if (ˏ2 < ˏ - 1) {
                linearLayout.addView(new Space(context), layoutParams);
            }
        }
        linearLayout.setPadding(ॱॱ, 0, ʽ, 0);
        viewGroup.addView(inflate);
        return true;
    }

    public boolean ॱ(chz o_chz, ViewGroup viewGroup) {
        if (this.ˊ != null) {
            if (o_chz.ॱ == 0) {
                this.ˊ.setVisibility(0);
            } else {
                this.ˊ.setVisibility(8);
            }
        }
        return super.ॱ(o_chz, viewGroup);
    }
}
